<?php
require_once 'init.php';
include 'isValidToken.php';
require_once 'Dingbot.php';
if(!$logined){
	echo "登陆失败";
	return;
}
$client = new GuzzleHttp\Client([
            'timeout' => 5.0,
        ]);
//伪装HTTP头
$headers=[
'User-Agent'=>'Mozilla/5.0 (Linux; U; Android 4.1.2; zh-cn; GT-I9300 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 MicroMessenger/5.2.380',
'Authorization'=>$Authorization,
'Connection'=>'keep-alive',
'Host'=>' courseapi.ulearning.cn',
'Origin'=>' https://courseweb.ulearning.cn',
'Accept'=>'application/json, text/javascript, */*; q=0.01',
'Sec-Fetch-Dest'=>'empty',
'Content-Type'=>'application/json',
'Sec-Fetch-Site'=>'same-site',
'Sec-Fetch-Mode'=>'cors',
'Referer'=>'https://courseweb.ulearning.cn/ulearning/index.html',
'Accept-Encoding'=>'gzip, deflate, br',
'Accept-Language'=>'zh-CN,zh;q=0.9',
];
include_once'qiangdalist.php';

while(true){
	foreach($list as $id=>$name){
	$res = $client->request('GET', "https://courseapi.ulearning.cn/classActivity/stu/$id/3?pn=1&ps=1", [
           
            'headers' => $headers
			
        ])->getBody()->getContents();
		$data=json_decode($res,true);
		$time=date("h:i:sa");
		if(!empty($data['list'])){
		if($data['list'][0]['timeDisplay']!='已结束'){
			Text("$name 待抢答 $time\n");
		}else{
			echo "$name 抢答结束 $time\n";
		}
		}else{
			echo "$name 无抢答 $time\n";
		}
		
	sleep(1);
	}
}


